﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Threading;
using shopsoft.models;

namespace shopsoft.main
{
    static class Program
    {
        /// <summary>
        /// 当前用户
        /// </summary>
        public static Users CurrentUser = new Users();

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            bool runone;
            Mutex run = new Mutex(true, "Client", out runone);
            if (runone)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                #region Login

                LoginSystem loginSystem = new LoginSystem();
                if (loginSystem.ShowDialog() == DialogResult.OK)
                {
                    loginSystem.Dispose();
                    Application.Run(new ShopSoftMain());
                }
                else
                {
                    loginSystem.Dispose();
                    Application.Exit();
                }
                run.ReleaseMutex();

                #endregion Login
            }
            else
            {
                MessageBox.Show("程序正在运行");
            }
        }
    }
}
